package com.yx.sql.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yx.common.core.utils.ListUtils;
import com.yx.common.core.utils.StringUtils;
import com.yx.sql.convert.DbConnectConverter;
import com.yx.sql.dao.DbConnectDao;
import com.yx.sql.entity.DbConnect;
import com.yx.sql.entity.vo.DbConnectVo;
import com.yx.sql.service.ConnectionService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author kai.yang
 * @date 2023/3/28 15:29
 */
@Log4j2
@Service
public class ConnectionServiceImpl  implements ConnectionService {

    @Resource
    DbConnectDao dbConnectDao;


    @Override
    public List<DbConnect> getConnectList(DbConnectVo dbConnectVo) {
        LambdaQueryWrapper<DbConnect> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isNotEmpty(dbConnectVo.getConnName())){
            lambdaQueryWrapper.like(DbConnect::getConnName,dbConnectVo.getConnName());
        }

        return dbConnectDao.selectList(lambdaQueryWrapper);
    }
}
